﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>How to start AppGauge DBDemo</title>
    <link rel="stylesheet" href="_Assets/style.css" />
</head>
<body>
    <header>

        <img src="_Assets/logo.png" alt="AppGauge" width="70" />
        <span style="color: rgb(0, 150, 255); font-size: 3.5em; font-weight: 100;">AppGauge</span>
    </header>
    <div id="content">
        <div class="qThread">
            <div class="qn">
              <div class="stepN">Step 0</div> 
                <div class="stepT">Know AppGauge Basics
                </div>
            </div>
            <div class="ans">
                <i>AppGauge,</i> in simple terms, <i>is a framework for developing complex ASP.NET web projects in very short time with very ease.</i>
                On the surface, AppGauge is very very simple, very easy to use and very robust and secure.
                <br />

                <br />
                In this tutorial, we will creat a new Database-driven application and see how AppGauge minimizes rudimentary tasks.
                We are going to create a small book storage management system for a publisher. For the sake of simplicity, lets assume the following fields:
                <ul>
                    <li>Book Name</li>
                    <li>Book Price</li>
                </ul>
                The inventory must be able to add new books as well as Delete and Update existing books.
                
            </div>
        </div>

        <div class="qThread">
            <div class="qn">
                <div class="stepN">Step 1</div> 
                <div class="stepT">Arrange all pre-requisites.
                </div>
                <div class="clr"></div>	
            </div>
            <div class="ans">
                In order to proceed with application development using AppGauge, you must have the following already installed on your system:
                 
                 <ol>
                     <li>
                         <span style="font-weight: bold">AppGauge :</span>
                         To start the development, you must have the AppGauge dll file with you. If not, download it from <a href="#" title="Download AppGauge Binary">here</a>.
                
                     </li>
                     <li>
                         <span style="font-weight: bold">AppGauge AppData CodeGenerator :</span>
                         The CodeGenerator is a simple tool to generate Business Objects on the fly and make your development more faster.
                
                     </li>
                     <li>
                         <span style="font-weight: bold">Visual Studio :</span>
                         You can use any version of Visual studio that supports .net version 2.0 and up. Collect the latest version <a href="#">here</a>.
                     </li>
                     <li>
                         <span style="font-weight: bold">SQL Server :</span>
                         AppGauge is designed to work with most of the version of SQL Server. We recommend you to first work with an express edition. Collect the latest version <a href="#">here</a>.
                     </li>
                     <li>
                         <span style="font-weight: bold">Extra :</span>
                         These resources are not mandatory however we recomend yo use these to speed up devellopment:
                         <ul>
                             <li>SQL Management Studio. Collect it <a href="#">here</a>.</li>
                             <li>AJAX Control Toolkit. Collect it <a href="#">here</a>.</li>
                         </ul>
                     </li>
                 </ol>
                <br />

                If you have successfully acquired all the above then you are ready to go to the nest step. 
               
            </div>
        </div>

        <div class="qThread">
            <div class="qn">
                <span class="stepN">Step 2</span> Create a Database.
            </div>
            <div class="ans">
                First, we organize the fields of the table 'tblBook' :
                <br /><br />
                <table border="1">
                    <tr>
                        <th>Field</th>
                        <th>Data Type</th>
                    </tr>
                    <tr>
                        <td>bookId</td>
                        <td>int( auto increment, primary key)</td>
                    </tr>
                    <tr>
                        <td>bookName</td>
                        <td>varchar(50)</td>
                    </tr>
                    <tr>
                        <td>bookPrice</td>
                        <td>number(400,2)</td>
                    </tr>
                </table>
                <br /><br />
                Script:
                <div class="code">
                    
                CREATE TABLE tblBook(
	bookId int IDENTITY(1,1) NOT NULL primary key,
	bookName varchar(50) NOT NULL,
	bookPrice numeric(4, 2) NULL);
                </div>

                Now, lets assume the following database connection details: <br /><br />
                <span style="font-weight:bolder">Database Sever: </span> Bhavitra/sqlexpress <br />
                <span style="font-weight:bolder">Database Name: </span> AppGauge <br />
                <span style="font-weight:bolder">User ID: </span> sa <br />
                <span style="font-weight:bolder">Password: </span> adminpass 
            </div>
        </div>

        <div class="qThread">
            <div class="qn">
               <span class="stepN"> Step 3</span> Create an ASP.NET Application.
            </div>
            <div class="ans">
                <p>After creating the table, lets create a new ASP.NET Application. Go to File > New Website.</p>
                <p>
                    Make sure you create an empty website. If you have other .aspx files, delete them and make sure you have only one .aspx file i.e. Default.aspx.
                </p>
                <p>
                    Now, link the appgauge.dll file by right clicking on the References Folder in the Solution Explorer and browsing the dll file.
                </p>
            </div>
        </div>

        <div class="qThread">
            <div class="qn">
                <span class="stepN">Step 4</span> Design Agents.
            </div>
            <div class="ans">
              With the invent of Fluent API 'AppData' creating AppGauge Apps is very simple. Load the CodeGenerator Tool. Input the connectionString and hit Connect. Business Objects willbe created dynamically out of all the tables in that database.
              <br /><br />
               By default, all the Business Objects will be places in "C:\AppData_Objects\"<br />
                Design the form with text boxes and gird view accordingly.Something Like :<br />
                <img src="_Assets/AppGaugeDemoPrint.jpg" alt="AppGauge Design Page" /><br />

                Business Objects will have the same filename and class name as Table Name. In this case, its<b>tblBook.cs</b> :
                <div class="code">
                <pre>
using AppGauge.Data.SqlServer.Fluent;

[Table("tblBook")]
class tblBook : AppData
{
	[Column("bookId",true)]
	public int bookId {get; set;}

	[Column("bookName")]
	public string bookName {get; set;}

	[Column("bookPrice")]
	public double bookPrice {get; set;}

	public tblBook()
	:base(@"Data Source=Bhavitra\sqlexpress;Initial Catalog=AppGauge;User ID=sa;Password=admin")
	{
	}
}
</pre>
                </div>
                <br /><br />
                Now, In your Default.aspx.cs code, just create an object of book and you are ready to manipulate the Book.<br />
                
<b><i>Creating an object of Book table</i></b>
<pre class="code">
tblBook bk = new tblBook();
</pre>
 <b>Adding new Book</b>
<pre class="code">
bk.bookName="Abar arekbar anekbar";
bk.bookPrice = 50.3;
bk.Save();
</pre>
<b>Viewing a Book</b>
<pre class="code">
bk.View(bk.bookId);
TextBox1.Text=bk.bookName;
</pre>
<b>Editing a Book</b>
<pre class="code">
bk.bookId(101);
bk.bookName="Bar Bar protibar";
bk.bookPrice = 50.3;
bk.Save();
</pre>
<b>Deleting a Book</b>
<pre class="code">
bk.Delete();
</pre>
                
                As easy as that!
            </div>
        </div>

        <div class="qThread">
            <div class="qn">
                <span class="stepN">Step 5</span> Debug and Execute.
            </div>
            <div class="ans">
                Do NOT forget to change the database connection details before firing up this demo. All the credentials is supposed to work with my local pc only.
            </div>
        </div>

    </div>
    <footer>
        AppGauge - An easy, realiable and fast Web Application Framework. 
       <span style="padding: 0 50px; font-style: italic">Drop a 'hello' @ <a href="mailto:info@bhavitra.com" title="Send email">Bhavitra</a>
       </span>
    </footer>
</body>
</html>

